package org.jeecg.modules.online.cgform.converter.impl;

import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.online.cgform.converter.channel.ConfigConvert;
import org.jeecg.modules.online.cgform.entity.OnlCgformField;
import org.jeecg.modules.online.cgform.util.CgformUtil;

import java.util.HashMap;
import java.util.Map;

/**
 * 分类字典
 */
public class CatTreeConverter extends ConfigConvert {

    private String treeText;

    public String getTreeText() {
        return treeText;
    }

    public void setTreeText(String treeText) {
        this.treeText = treeText;
    }

    public CatTreeConverter(OnlCgformField onlCgformField){
        super(CgformUtil.CATEGORY_TABLE_NAME,CgformUtil.CATEGORY_ID_NAME,CgformUtil.CATEGORY_TEXT_NAME);
        this.treeText = onlCgformField.getDictText();
        this.field = onlCgformField.getDbFieldName();
    }

    @Override
    public Map<String, String> getConfig() {
        if(oConvertUtils.isEmpty(treeText)){
            return null;
        }
        Map<String,String> map = new HashMap<String,String>();
        map.put("treeText",treeText);
        map.put("field",field);
        return map;
    }
}

